import { message } from "antd";

export const httpStatus = new Map([
    [400, message.error("请求失败！请您稍后重试")],
    [401, message.error("登录失效！请您重新登录")],
    [403, message.error("当前账号无权限访问")],
    [404, message.error("你所访问的资源不存在")],
    [405, message.error("请求方式错误！请您稍后重试")],
    [408, message.error("请求超时！请您稍后重试")],
    [500, message.error("服务异常!")],
    [502, message.error("网关错误!")],
    [503, message.error("服务不可用!")],
    [504, message.error("网关超时!")],
])

export default function checkStatus (status){
    if(httpStatus.has(status)){
        return httpStatus.get(status);
    } else {
        return message.error("请求失败!");
    }
}